<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Socket.io</title>
</head>
<body>
<h1>socket demo</h1>
<div id="app">
    <h2>从服务器接收的消息：{{ progress }}</h2>
    <h3 v-if="finished">传输结束</h3>
</div>
<script src="static/vue/dist/vue.js"></script>
<script src="static/socket.io-client/dist/socket.io.js"></script>
<script>
    var data = {progress:0,finished:false};

    new Vue({
       'el':'#app',
        data:data
    });

    var socket = io('http://192.168.205.113:8000');
    socket.on('update', function (p) {
        data.progress = p*2;
    });

    socket.on('finish', function () {
        data.finished = true;
    })
</script>
</body>
</html>